package com.engine4cloud.tdf.supervision.controller.inner;

import com.engine4cloud.tdf.common.core.util.R;
import com.engine4cloud.tdf.common.data.web.response.PageInfo;
import com.engine4cloud.tdf.common.security.annotation.Inner;
import com.engine4cloud.tdf.supervision.dto.query.JzdxLocPhoneQueryDTO;
import com.engine4cloud.tdf.supervision.dto.query.JzdxTerminalQueryDTO;
import com.engine4cloud.tdf.supervision.dto.result.JzdxLocPhoneResultDTO;
import com.engine4cloud.tdf.supervision.dto.result.JzdxTerminalManageResultDTO;
import com.engine4cloud.tdf.supervision.dto.result.JzdxTerminalNeedLocResultDTO;
import com.engine4cloud.tdf.supervision.service.JzdxTerminalManageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 矫正对象-监管设备绑定-inner
 *
 * @author wenjie
 * @date 2024-04-19 11:21:59
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/inner/cor/terminal/manage")
@Tag(description = "CorTerminalManage", name = "矫正对象-监管设备绑定管理-inner")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class JzdxTerminalManageInnerController {

    private final JzdxTerminalManageService terminalManageService;

    /**
     * 需要定位的人员
     *
     * @param deptId 部门id
     * @return R<JzdxTerminalNeedLocResultDTO>
     */
    @Inner
    @Operation(summary = "需要定位的人员", description = "需要定位的人员")
    @GetMapping("/find/{deptId}")
    public R<List<JzdxTerminalNeedLocResultDTO>> findNeedLoc(@Schema(description = "部门id") @PathVariable("deptId") Long deptId) {
        return R.ok(terminalManageService.findNeedLoc(deptId));
    }

    /**
     * 基站定位人员分页查询
     *
     * @param dto 查询条件
     * @return R<PageInfo < JzdxLocPhoneResultDTO>>
     */
    @Inner
    @Operation(summary = "基站定位人员分页查询", description = "基站定位人员分页查询")
    @PostMapping("/page")
    public R<PageInfo<JzdxLocPhoneResultDTO>> locPhoneList(@Valid @RequestBody JzdxLocPhoneQueryDTO dto) {
        return R.ok(terminalManageService.locPhoneList(dto));
    }


    /**
     * 通过设备查询矫正对象信息
     *
     * @param dto 查询条件
     * @return R<JzdxTerminalManageResultDTO>
     */
    @Inner
    @Operation(summary = "通过设备查询矫正对象信息", description = "通过设备查询矫正对象信息")
    @PostMapping("/find")
    public R<JzdxTerminalManageResultDTO> findByTerminal(@Valid @RequestBody JzdxTerminalQueryDTO dto) {
        return R.ok(terminalManageService.findByTerminal(dto));
    }

}